/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.prashant.sqlduniya.dbexplorer;

import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.List;
import org.openide.nodes.ChildFactory;
import org.openide.nodes.Children;
import org.openide.nodes.Node;
import org.prashant.sqlduniya.sqlmanager.DBNode;

/**
 *
 * @author prashant
 */
public class CatalogBeanFactory extends ChildFactory<String> {

    private DBNode dbNode = null;

    public CatalogBeanFactory(DBNode dbNode) {
        this.dbNode = dbNode;        
    }

    @Override
    protected boolean createKeys(List<String> toPopulate) {        
        toPopulate.addAll(dbNode.getSchemas());
        return true;
    }

    @Override
    protected Node createNodeForKey(String key) {
        return new CatalogBeanNode(key,
                Children.create(new CatalogChildFactory(key), false));
    }
}
